package org.putrpctorest.parameter.impl.log;

import java.util.ArrayList;
import java.util.List;

import org.putrpctorest.parameter.impl.CORRESPONDENCE;
import org.putrpctorest.parameter.impl.Definition;
import org.putrpctorest.parameter.impl.Definitions;

public class MatchLog {
	
	private List<Event> events = new ArrayList<Event>();

	public void startMatch(Definitions params1,
			Definitions params2) {
		events.add(new StartMatch(params1, params2));
	}
	
	public void flattenWasUnsuccessfull(Definitions definitions) {
		events.add(new FlattenWasUnsuccessfullEvent(definitions));
	}

	public void diferentSizeParamters() {
		events.add(new DiferentSizeParametersEvent());
	}

	public void definitionHasInterchangeableTypes(Definition param1, Definition param2) {
		events.add(new DefinitionsHasInterchangeableTypesEvent(param1, param2));
		
	}

	public void correspondenceWasNotPossible(CORRESPONDENCE correspondence) {
		events.add(new CorrespondenceWasNotPossible(correspondence));
	}
	
	public void startFlatting(Definitions definitions) {
		events.add(new StartFlatting(definitions));
		// TODO Auto-generated method stub
		
	}
	
	
	public List<Event> getEvents() {
		return new ArrayList<Event>(events);
	}
	
	@Override
	public String toString() {
		StringBuffer tmp = new StringBuffer();
		
		boolean first = true;
		for(Event event:events) {
			if (first) {
				first = false;
			}
			else {
				tmp.append('\n');
			}
			tmp.append(event);
		}
		return tmp.toString();
	}


	

}
